<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>管理中心</title>
	<link href="../css/public.css" rel="stylesheet"/>
	<link href="../css/main.css" rel="stylesheet"/>
	<link href="../css/style.css" rel="stylesheet"/>
	<link href="../css/agent.css?v=12" rel="stylesheet"/>
	<script src="http://www.jq22.com/jquery/jquery-1.9.1.js"></script>
	<script src="../js/swiper.min.js"></script>
	<script src="../js/mobile-util.js"></script>
	<script src="../js/public.js"></script>
	<script src="../js/jquery.cookie.js"></script>

	<script>
		/*获取url参数*/
		function getUrlParam(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
			var r = window.location.search.substr(1).match(reg);  //匹配目标参数
			if (r != null) return unescape(r[2]); return null; //返回参数值
		}

		/*获取url参数end*/
	</script>

</head>
<body >

<div class="markbox">
	<img src="../img/loading1.gif" />
</div>

<header class="mui-bar mui-bar-nav indexheader bluebg flex">
	<div class="headerlogo" onclick="back()">
		<i class="iconfont backbtn">&#xe602;</i>
	</div>

	<div class="headertitle">
		<p>管理中心</p>
	</div>

	<div class="headerright timeright hide">
		<p class="timepbox iconfont">&#xe6d9;</p>
	</div>

</header>

<main class="agentbox">
	<div class="headerbox" id="agentinfo">
		<div class="headportrait">
			<img src="../img/center.png">
		</div>

		<div class="headerinfo">
			<p class="headtitle" id="agentname">千里狐</p>
			<p class="headgrade">
				<span id="agentgrade"></span>
			</p>

		</div>

		<div class="iconfont headright">
			&#xe601;
		</div>


	</div>

	<div class="div-5rem"></div>

	<div class="agentmeun">
		<!-- <div class="agentmeunlist">
			<div class="flex">
				<div class="meuninfo">
					<span class="iconfont co-yellow">&#xe62d;</span>
					<span class="agenttitle">收入 &yen<em class="agentprice">0</em></span>
				</div>

				<div class="meunbtn te-ri" id="price">
					<button>查看明细</button>
				</div>

			</div>
		</div> -->

		<div class="agentmeunlist">
			<div class="flex">
				<div class="meuninfo">
					<span class="iconfont co-blue">&#xe6ec;</span>
					<span class="agenttitle">设备：<em id="devicenum"></em>台
						<span class="agenttitle" style="margin-left: .3rem">激活：<em id="deviceactivation"></em>台</span></span>
				</div>

				<div class="meunbtn te-ri" id="equipment">
					<button>查看明细</button>
				</div>

			</div>
		</div>

		<div class="agentmeunlist">
			<div class="flex">
				<div class="meuninfo">
					<span class="iconfont co-red">&#xe640;</span>
					<span class="agenttitle">充值记录：<em class="agenttitle" id="orderlimt">99</em>条</span>
				</div>

				<div class="meunbtn te-ri" id="recharge">
					<button>查看明细</button>
				</div>

			</div>
		</div>

		<div class="agentmeunlist" >
			<div class="flex">
				<div class="meuninfo">
					<span class="iconfont co-green">&#xe64c;</span>
					<span class="agenttitle">公司介绍</span>
				</div>

				<div class="meunbtn te-ri" onclick="window.location.href='company.html'">
					<button>查看明细</button>
				</div>

			</div>
		</div>


	</div>

</main>



</body>


<script>

	$(function () {


	});

	var tooken=$.cookie("tooken");


	if(tooken==null||tooken==undefined||tooken==""){

		window.location.href="../agent/login.html";

	}else {
		var cce;
		cee = setTimeout(function(){
			$('.markbox').hide();
			clearTimeout(cce);

		}, 1000);


		var name=$.cookie("tooken");
		//alert(name);

		var url="http://ht.hiberbest.com";
		//var url="http://192.168.0.132:69";
		var geturl=url+ "/Admin/agentapi/agentinfo?tooken="+name;

		$.ajax({
			type: 'get',
			dataType: "json",
			url: geturl,
			success: function (data) {
				//console.log(data);
				var suc=data.success;
				if(suc.code == 4007){
					alert(suc.message);
					window.location.href="login.html";
				}else if(suc.code == 4011){
					alert(suc.message);
					window.location.href="login.html";
				}else if(suc.code == 4000){
					var agent=data.agent;
					var agent_level=agent.agent_level;

					if(agent_level==2){
						$('#agentgrade').html("代理");
					}

					var agent_qq=agent.agent_qq;

					var device=data.device;

					$('#devicenum').html(device.count);
					$('#deviceactivation').html(device.jihuo);

					var order=data.order;
					var money=data.money;
					$('.agentprice').html(money);

					$('#orderlimt').html(order);

					if(agent.agent_name==null||agent.agent_name==undefined||agent.agent_name==""){
						$('#agentname').html("千里狐wifi");
					}else{
						$('#agentname').html(agent.agent_name);
					}





				}

			},error:function(data){
				console.log("请检查您的网络");
			}
		});
	}





	$('#price').click(function(){
		window.location.href="income.html";
	});

	$('#equipment').click(function(){
		window.location.href="mydevice.html";
	});

	$('#recharge').click(function(){
		window.location.href="rechargerecord.html";
	});


	$('#agentinfo').click(function(){
		window.location.href="agentinfo.html";
	});


</script>

</html>
